package com.atgion.service.sentinel;


import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

// 只允许网关请求
@Component
public class HeaderOriginParser implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        String header = httpServletRequest.getHeader("origin");
        if(header==null){
            header="blank";
        }
        return header;
    }
}
